package com.niit.serviceorder.service;

import com.niit.common.entity.TbOrder;
import com.niit.serviceorder.mapper.TbOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbOrderServiceImpl implements TbOrderService {

    @Autowired
    private TbOrderMapper tbOrderMapper;

    @Override
    public List<TbOrder> getAllOrders() {
        return tbOrderMapper.selectAll();
    }

    @Override
    public TbOrder getOrderById(Long id) {
        return tbOrderMapper.selectById(id);
    }

    @Override
    public int createOrder(TbOrder order) {
        return tbOrderMapper.insert(order); // 修改返回值处理

    }

    @Override
    public int updateOrder(TbOrder order) {
        return tbOrderMapper.update(order); // 修改返回值处理
    }

    @Override
    public int deleteOrder(Long id) {
        return tbOrderMapper.deleteById(id); // 修改返回值处理
    }
}